package edu.tsinghua.mrpvc.device.phone;

import java.util.Dictionary;
import java.util.Hashtable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;

import edu.tsinghua.mrpvc.device.PhoneDevice;
//import edu.tsinghua.mrpvc.simulate.util.SimulateTopic;

public class Activator implements BundleActivator, EventHandler {

	//private final static String[] SIMULATE_TOPICS = {SimulateTopic.PHONE_RING, SimulateTopic.PHONE_OVER};
//	private PhoneDeviceImpl phone;
	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
//		phone = new PhoneDeviceImpl(context);
//		context.registerService(PhoneDevice.class.getName(), phone, null);
		/*
		Dictionary<String, Object> property = new Hashtable<String, Object>();
		property.put(EventConstants.EVENT_TOPIC, SIMULATE_TOPICS);
		context.registerService(EventHandler.class.getName(), this, property);
		*/
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
	}

	@Override
	public void handleEvent(Event event) {
		// TODO Auto-generated method stub
		/*
		if(event.getTopic().equals(SimulateTopic.PHONE_RING)){
			phone.ring();
		}
		else if(event.getTopic().equals(SimulateTopic.PHONE_OVER)){
			phone.over();
		}
		*/
	}

}
